package com.ss.movierecommendationsystem.controller;

import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonObject;
import com.ss.movierecommendationsystem.base.Pojo.RespInfo;
import com.ss.movierecommendationsystem.base.entity.TestUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Zhaoluowei
 * @version 1.0
 * @date 2019/4/28 14:22
 */
@RestController
@Slf4j
@RequestMapping(value = "/test")
public class TestController {


    @PostMapping(value = "/testLogin")
    public RespInfo TestLogin(@RequestBody TestUser testUser) {
        log.info(" ==== 测试登陆 ==== 进入" + "\n" + testUser);
        RespInfo respInfo = new RespInfo();
        if (testUser != null && testUser.getUsername() != null && testUser.getPassword() != null) {
            respInfo.setCode(0).setMsg("获取成功").setData(testUser);

        } else {
            respInfo.setCode(1).setMsg("获取失败").setData("");
        }
        log.info(" ==== 测试登陆 ==== 离开");
        return respInfo;
    }


}
